#pragma once
#include<string>
namespace maxc
{
	class URIParse
	{
	public:
		std::string uri;
		std::string hostname;
		std::string path;
	public:
		URIParse(std::string myuri) :uri(myuri) {}
		void Parse()
		{
			int count = 0;
			auto ptr = uri.c_str();
			auto cur = ptr;
			ptr = cur + uri.length();
			size_t pos = 0;
			size_t hnpos = 0;
			size_t pathpos = 0;
			while (cur != ptr && count != 3)
			{
				if (*cur == '/')
				{
					if (count == 1)
					{
						hnpos = pos;
					}
					pathpos = pos;
					++count;
				}
				++cur;
				++pos;
			}
			hostname = uri.substr(hnpos + 1, pathpos - hnpos - 1);
			path = uri.substr(pathpos);
		}
	};
}